/***********************************************
 * Title:       LogUtil.java
 * Description: LogUtil.java
 * Author:      Niyuzhe
 * Create Date: 2010-2-2
 * CopyRight:   CopyRight(c)@2009
 * Company:     TJUSCS
 * Version:     1.0
 ***********************************************
 */
package com.younker.waf.utils;

import java.util.Iterator;


/**
 * @author Niyuzhe
 *
 */
public class StringUtil
{
        public static <T> String toString( Iterable<T> iterable, String separator)
        {
                StringBuilder sb = new StringBuilder();
                
                Iterator<T> iter = iterable.iterator();
                
                if( iter.hasNext())
                        sb.append(iter.next());
                while( iter.hasNext() )
                {
                        sb.append(separator).append(iter.next());
                }
                
                return sb.toString();
        }
        
        public static <T> String toString( Iterable<T> iterable)
        {
                return toString(iterable, "\n");
        }
        
}
